package com.itfenghuang.day14;
/*
吃货  消费者
 */
public class A03_Foodie extends Thread{

    @Override
    public void run() {
        while (true){
            synchronized(A03_Dask.o){
                if (A03_Dask.flag){
//                    说明桌子有菜
                    System.out.println("吃货来吃菜");
//                    桌子上没菜
                    A03_Dask.flag=false;
//                    叫醒厨子
                    A03_Dask.o.notifyAll();
                }else {
//                    吃货等待
                    try {
                        A03_Dask.o.wait();
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            }
        }
    }
}
